{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Choropleth Map\n",
    "==============\n",
    "A choropleth map of unemployment rate per county in the US\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# category: geographic\n",
    "\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "from vega_datasets import data\n",
    "\n",
    "counties = alt.topo_feature(data.us_10m.url, 'counties')\n",
    "unemp_data = data.unemployment.url\n",
    "\n",
    "\n",
    "alt.Chart(counties).mark_geoshape().encode(\n",
    "    color='rate:Q'\n",
    ").transform_lookup(\n",
    "    lookup='id',\n",
    "    from_=alt.LookupData(unemp_data, 'id', ['rate'])\n",
    ").project(\n",
    "    type='albersUsa'\n",
    ").properties(\n",
    "    width=500,\n",
    "    height=300\n",
    ")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
